package com.tbit.uqbike.service.rpcservice;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tbit.uqbike.object.business.PageData;
import com.tbit.uqbike.object.pojo.MachineOperationsStat;
import com.tbit.uqbike.object.pojo.MachineStatusFlag;
import com.tbit.uqbike.object.pojo.dto.MachineOperationsStatDownloadDTO;
import com.tbit.uqbike.object.pojo.statistics.ExportMachine;
import com.tbit.uqbike.object.pojo.vo.MachineOperationsStatChartVO;
import com.tbit.uqbike.object.value.LoginInfo;
import com.tbit.common.entity.view.Result;
import com.tbit.uqbike.webmanager.business.vehicle_operation_report.enums.TimeDuration;
import org.springframework.web.servlet.support.RequestContext;

import java.util.List;
import java.util.Map;

/**
 * @author MyWin E-mail:335918956@qq.com
 * @version 1.0
 * @createTime 2019-12-10 15:00
 */
public interface MachineManagerService {

    MachineStatusFlag getByKey(LoginInfo info, Integer accountId, String key, Integer mapType);

    /**
     * 根据电量查询
     *
     * @param accountId
     * @param soc
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getByPower(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer soc, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionList);

    /**
     * 查询所有
     *
     * @param accountId
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getAll(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionList);


    /**
     * 根据闲置时间查询
     *
     * @param accountId
     * @param hours
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getByUnuse(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer hours, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionIdList);

    /**
     * 查询故障车辆
     *
     * @param accountId
     * @param mapType
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getByFault(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionList);

    /**
     * 查询异常车辆
     *
     * @param accountId
     * @param abnormalType
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getByAbnormal(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer abnormalType, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionList);

    /**
     * 异常统计
     *
     * @param info
     * @param accountId
     * @return
     */
    Map<String, Integer> statAbnormal(LoginInfo info, Integer accountId, List<Integer> regionList);

    Map<String, Integer> statAbnormal(LoginInfo info, List<Integer> accountId);

    Map<String, Integer> statIdle(LoginInfo info, List<Integer> accountId);

    Map<String, Integer> statBattery(LoginInfo info, List<Integer> accountId);

    Map<String, Integer> statAllState(LoginInfo info, List<Integer> accountId);

    /**
     * 获取正在骑行的车辆列表
     *
     * @param info
     * @param accountId
     * @param machineType
     * @return
     */
    PageData<List<MachineStatusFlag>> getByUse(LoginInfo info, Boolean sortByLast, Boolean sortByBatDt, Boolean sortByPosDt, Integer accountId, Integer mapType, Integer rowCount, Integer pageNO, Integer machineType, List<Integer> regionIdList);

    List<ExportMachine> export(PageData<List<MachineStatusFlag>> pageDatas, RequestContext context);

    Page<MachineOperationsStat> selectMachineOperationsStatPage(String accountIds, String startTime, String endTime, String orderBy, Integer rowCount, Integer pageNO, TimeDuration duration);

    String machineOperationsStatExportCsv(MachineOperationsStatDownloadDTO machineOperationsStatDownloadDTO);

    List<MachineOperationsStatChartVO> selectMachineOperationsStatChart(String accountIds, String startTime, String endTime, Integer dateType);

    /**
     * return 车辆状态统计列表导出
     * @param machineOperationsStatDownloadDTO 入参
     * @return 文件名
     */
    Result<Object> machineOperationsStatExport(MachineOperationsStatDownloadDTO machineOperationsStatDownloadDTO);
}
